﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SMTC.Model.Model;
using SMTC.WebCommon.Common;

public partial class PlanMangement_PlanView : BasePage
{


    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected override void OnLoadComplete(EventArgs e)
    {
        string[] str = dll_PlanVersion.Text.Split('-');
        if (str != null && str.Length > 1)
        {
            this.txtEffectiveTimeStart.Value = str[0].Substring(0, 4)  + "-01-01";
            this.txtEffectiveTimeEnd.Value = str[0].Substring(0, 4)  + "-12-31";
        }
        base.OnLoadComplete(e);
    }

    protected void gvPlanView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ReportDataSourceModel item = e.Row.DataItem as ReportDataSourceModel;
            LinkButton lbtn_View = e.Row.FindControl("lbtn_View") as LinkButton;
            LinkButton lbtn_Chart = e.Row.FindControl("lbtn_Chart") as LinkButton;

            lbtn_View.PostBackUrl = "~/ReportManagment/ReportView.aspx?buName=" + item.BU
                                                                                + "&start=" + txtEffectiveTimeStart.Value.Trim()
                                                                                + "&end=" + txtEffectiveTimeEnd.Value.Trim()
                                                                                + "&version=" + dll_PlanVersion.Text
                                                                                + "&PUVersion=" + dll_PUVersion.Text;
            lbtn_Chart.PostBackUrl = "~/ReportManagment/ReportChartView.aspx?buName=" + item.BU
                                                                                      + "&start=" + txtEffectiveTimeStart.Value.Trim()
                                                                                      + "&end=" + txtEffectiveTimeEnd.Value.Trim()
                                                                                      + "&version=" + dll_PlanVersion.Text
                                                                                      + "&PUVersion=" + dll_PUVersion.Text;
        }
    }

}